package com.artPreter.service.impl;


import com.artPreter.mapper.SystemConfigMapper;
import com.artPreter.pojo.SystemConfig;
import com.artPreter.service.ISystemConfigService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 * 系统设置表 服务实现类
 * </p>
 *
 * @author jarvis
 * @since 2024-12-27
 */
@Service
public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, SystemConfig> implements ISystemConfigService {


    @Override
    public HashMap getSystemConfig() {
        LambdaQueryWrapper<SystemConfig> queryWrapper = new LambdaQueryWrapper<>();
        List<SystemConfig> systemConfigs = this.baseMapper.selectList(queryWrapper);
        HashMap<String, String> result = new HashMap<>();
        for (int i = 0; i < systemConfigs.size(); i++) {
            result.put(systemConfigs.get(i).getKeyName(),systemConfigs.get(i).getConfigValue());
        }
        return result;
    }
}
